import request from '../../utils/request';

// 消息管理相关 API

// 创建消息
export const createMessage = (data: any) => {
    return request({
        url: '/system/api/message',
        method: 'post',
        data
    });
};

// 获取消息详情
export const getMessageDetail = (id: string) => {
    return request({
        url: `/system/api/message/${id}`,
        method: 'get'
    });
};

// 更新消息
export const updateMessage = (id: string, data: any) => {
    return request({
        url: `/system/api/message/${id}`,
        method: 'put',
        data
    });
};

// 删除消息
export const deleteMessage = (id: string) => {
    return request({
        url: `/system/api/message/${id}`,
        method: 'delete'
    });
};

// 批量删除消息
export const deleteMessagesBatch = (data: any) => {
    return request({
        url: '/system/api/message/batch',
        method: 'delete',
        data
    });
};

// 分页查询消息列表
export const getMessagePage = (params: any) => {
    return request({
        url: '/system/api/message/page',
        method: 'get',
        params
    });
};

// 获取用户消息列表
export const getUserMessageList = (receiverId: string) => {
    return request({
        url: `/system/api/message/user/${receiverId}`,
        method: 'get'
    });
};
